<template>
    <div class="box1 bordert">
        <div class="ttitle">{{ jilu }}<button class="bun2" @click="qiehuan">切换到提现记录</button><button class="bun" @click="qiehuan2">切换充值记录</button></div>
        <!-- <div class="num">
            <span>邀请人数：</span>
            <span>20人</span>
        </div> -->
        <div class="invlists1">
            <div class="invtable1">
                <table class="tablet1" width="90%" align='center' border="1px solid" bordercolor="#D9D9D9" cellspacing="0" cellpadding="0" style="border-collapse:collapse;">
                    <tr class="invtitle1">
                    <th>金额</th>
                    <th>时间</th>
                    <th v-if="typ==2">提现手机号</th>
                    <!-- <th>状态</th> -->
                    </tr>
                    <tr v-for="(item, index) in vlist" :key="index">
                    <td style='height:40px;' align='center' valian='middle'>{{ item.ymoney }}</td>
                    <td style='height:40px;' align='center' valian='middle'>{{ item.updateDate }}</td>
                    <td v-if="typ==2" style='height:40px;' align='center' valian='middle'>{{ item.yphone }}</td>
                    <!-- <td style='height:40px;' align='center' valian='middle'>{{ item.state }}</td> -->
                    </tr>
                    <!-- <tr>
                    <td>row 2, cell 1</td>
                    <td>row 2, cell 2</td>
                    </tr> -->
                </table>
            </div>
            <div style="height:500px"></div>
        </div>
    </div>
</template>
<script>
export default {
  data () {
    return {
        jilu:'充值记录',
        typ:'1',
        vlist: []
    }
  },
  created() {
    //   console.log('邀请')
    //   this.huoquyaoqin()
  },
  mounted() {
      this.chongzhijilu()
  },
  methods: {
      async chongzhijilu() {
          var id = ''
          id = JSON.parse(window.localStorage.getItem('yonghuxinxi')).id
          console.log(id)
          var yongj = new FormData()
          yongj.set('userId',id)
          yongj.set('type',this.typ)
          const { data: res } = await this.$http.post('app/zqDeposit/getDepositList.do',yongj)
        console.log(res)
            this.vlist = res.data
        if (res.code !== 0) return console.log('获取记录失败')
        console.log('获取记录成功')
      },
      qiehuan() {
          this.typ = 2
          this.jilu = '提现记录'
          this.chongzhijilu()
      },
      qiehuan2() {
          this.typ = 1
          this.jilu = '充值记录'
          this.chongzhijilu()
      }
  }
  }
</script>
<style lang="less" scoped>
@import "../../assets/css/index.css";
    .box1 {
        background-color: #fff;
        .ttitle {
            position: relative;
            .bun {
                position: absolute;
                height: 40px;
                line-height: 40px;
                width: 150px;
                top: 15px;
                right: 40px;
            }
            .bun2 {
                position: absolute;
                height: 40px;
                line-height: 40px;
                width: 150px;
                top: 15px;
                right: 200px;
            }
        }
        .num {
            height: 50px;
            border-top: 1px solid #F1F1F1;
            line-height: 50px;
            padding-left: 20px;
        }
        .invlists1 {
            margin-top: 20px;
            .invtable1 {
                // text-align: center;
                .tablet1 {
                    color: #696969;
                    margin:auto;
                    .invtitle1 {
                    background-color: #F3F3F3;
                    height: 50px;
                }
                }
            }
        }
    }

</style>